<!--水军主播-->
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="店铺名" prop="shopName">
        <el-input
          v-model="queryParams.shopName"
          placeholder="请输入店铺名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="主播名" prop="anchorName">
        <el-input
          v-model="queryParams.anchorName"
          placeholder="请输入主播名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="lastLoginTime">
        <el-select v-model="queryParams.passFlag" clearable placeholder="请选择">
          <el-option v-for="(item, index) in passFlagList" :key="index" :label="item.label" :value="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="listList" border>
      <el-table-column label="带货店铺" align="center" prop="shopName" width="160" :show-overflow-tooltip="true"/>
      <el-table-column label="带货主播" align="center" prop="anchorName" width="160" :show-overflow-tooltip="true"/>
      <el-table-column label="审批状态" align="center" prop="passFlag" width="120" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.passFlag == 0">审核中</el-tag>
          <el-tag v-if="scope.row.passFlag == 1" type="danger">审核未通过</el-tag>
          <el-tag v-if="scope.row.passFlag == 2" type="success">审核通过</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="max-operate-tab" width="180" fixed="right">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['user:list:edit']">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 查看信息 -->
    <el-dialog title="查看" :visible.sync="open1" width="900px" append-to-body>
      <el-descriptions class="margin-top" title="" :column="3"  border>
        <el-descriptions-item>
          <template slot="label">
            带货店铺
          </template>
          {{formLook.shopName}}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            带货主播
          </template>
          {{formLook.anchorName}}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            审核状态
          </template>
          <el-tag v-if="formLook.passFlag == 0" >审核中</el-tag>
          <el-tag v-if="formLook.passFlag == 1" type="danger">审核未通过</el-tag>
          <el-tag v-if="formLook.passFlag == 2" type="success">审核通过</el-tag>
        </el-descriptions-item>
      </el-descriptions>
      <div slot="footer" class="dialog-footer">
        <el-button @click="open1 = false">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { anchorList } from '@/api/navy/user'

export default {
  name: 'user',
  data() {
    return {
      //审批状态
      passFlagList: [{ label: '审核中', value: 10 }, { label: '审核未通过', value: 1 }, {label: '审核通过',value:2}],
      // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        shopName:'',
        anchorName:'',
        passFlag:'',
        pageNum: 1,
        pageSize: 10,
      },
      open1:false,
      //修改用户信息
      form:{
        count:null,
        names:null,
        addShop: '1',
        addAnchor: '1',
      },
      formLook:{},
      listList:[],
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询用户列表列表 */
    getList() {
      this.loading = true
      anchorList(this.queryParams).then(response => {
        this.listList = response.data.records
        this.total = response.data.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum=1
      this.getList()
    },
    handleLook(row){
      this.open1 = true;
      this.formLook = JSON.parse(JSON.stringify(row))
    },
    resetQuery(){
      this.queryParams.passFlag = ''
      this.$refs['queryForm'].resetFields()
      this.getList()
    },
  }
}
</script>
